package com.tempjob.common.businesss.mongo.entity;

import com.anwen.mongo.annotation.ID;
import com.anwen.mongo.annotation.collection.CollectionField;
import com.anwen.mongo.annotation.collection.CollectionName;
import com.anwen.mongo.enums.FieldFill;
import com.anwen.mongo.enums.IdTypeEnum;
import com.tempjob.common.vo.admin.PermissionRespNode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Version;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 系统角色
 * @TableName sys_role
 */
@CollectionName(value ="sys_role")
@Data
public class SysRole implements Serializable {

    @ID(type = IdTypeEnum.OBJECT_ID)
    @CollectionField("_id")
    private String id;

    @CollectionField(value = "name")
    @ApiModelProperty("角色名称")
    private String name;

    @CollectionField(value = "description")
    @ApiModelProperty("")
    private String description;

    @CollectionField(value = "status")
    @ApiModelProperty("状态(1:正常0:弃用)")
    private Integer status;

    @CollectionField(value = "update_time")
    @ApiModelProperty("更新时间")
    private Date updateTime;

    @CollectionField(value = "deleted")
    @ApiModelProperty("是否删除(1未删除；0已删除)")
    private Boolean deleted;

    @CollectionField(value = "oper_time",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间",hidden = true)
    private Date operTime;

    @CollectionField(value = "oper_id",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人id",hidden = true)
    private Long operId;

    @CollectionField(value = "oper_name",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人",hidden = true)
    private String operName;

    @CollectionField(value = "create_id",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人id",hidden = true)
    private Long createId;

    @CollectionField(value = "create_name",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人",hidden = true)
    private String createName;

    @CollectionField(value = "create_time",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间",hidden = true)
    private Date createTime;

    @Version
    @CollectionField("version")
    @ApiModelProperty(value = "乐观锁", hidden = true)
    private Integer version;

    @CollectionField(exist = false)
    private List<PermissionRespNode> permissionRespNodes;

    @CollectionField(exist = false)
    private List<String> permissionIds;

    @CollectionField(exist = false)
    private static final long serialVersionUID = 1L;
}
